#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>

struct A
{
    char a1;
    int a2;
};

void test01()
{
    struct A a = {'b', 20};
    int aa = *((int *)((char *)&a + offsetof(struct A, a2)));
    printf("A.a2:%d\n", aa);
    printf("A.a2:%d\n", *((int *)&a + 1));
}

struct C
{
    int a;
    double b;
};

struct B
{
    char a;
    int b;
    struct C c;
};


void test02()
{
    struct B b = {'a',  20,  30,  3.14};

    int offset1 = offsetof(struct B, c);
    int offset2 = offsetof(struct B, b);

    //printf("%f\n", *((double *)( (    (char*)&b + offset1 ) + offset2 ) ));
    printf("%d\n", &(b.c.b));
}

int main(int argc, char const *argv[])
{
    //test01();
    test02();
    return 0;
}